<?php

class Controllers_Product extends Libs_Controller {

    function __construct() {
        parent::__construct();
    }

    public function index(){
        $pro = new Models_Product();
        $this->view->listPro = $pro->getAllProduct();
        $this->view->render('product/index');
    }
    
    public function detail($param = null){
        if(isset($param[0]) && preg_match('/^[a-zA-Z0-9-]+$/', $param[0])){
            $pro = new Models_Product();
            $this->view->detailPro = $pro->getDetailProductByUrl($param[0]);
            $this->view->render('product/detail');
        }else{
            header('location:'.PATH);
        }
    }
            
}

